// src/main/java/com/example/springbootdemo2/service/UserService.java
package com.example.springbootdemo2.service;

import com.example.springbootdemo2.entity.User;
import com.example.springbootdemo2.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public List<User> findAll() {
        return userMapper.findAll();
    }

    public User findById(Integer id) {
        return userMapper.findById(id);
    }

    public int insert(User user) {
        return userMapper.insert(user);
    }

    public int update(User user) {
        return userMapper.update(user);
    }

    public int deleteById(Integer id) {
        return userMapper.deleteById(id);
    }
}



